﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebeTerm.PlugIns;

namespace WebeTerm.ClearQ
{
    /// <summary>
    ///  Q信息结果类.
    /// </summary>
    public sealed class QResult:BasePlugInResult
    {
        /// <summary>
        /// Q信息类型SR、SC、KK
        /// </summary>
        public string QMessageType { get; set; }
        
        /// <summary>
        /// Q信息序号
        /// </summary>
        public string QMessageNo { get; set; }

        /// <summary>
        /// Q信息数量
        /// </summary>
        public string QMessageCount { get; set; }

        /// <summary>
        /// PNR编码
        /// </summary>
        public string PNRNo { get; set; }

        /// <summary>
        /// Q信息原文
        /// </summary>
        public string QMessage { get; set; }

        /// <summary>
        /// 操作员工标识
        /// </summary>
        public string EmployeeNo { get; set; }

        /// <summary>
        /// 是否存在变更
        /// </summary>
        public bool HasChanged { get;set; }

        /// <summary>
        /// 转换为显示字符串
        /// </summary>
        /// <returns>System.String.</returns>
        public override string ToDisplay()
        {
            if (string.IsNullOrEmpty(QMessageNo)) {
                return string.Format(@"共存在 {0} 个 {1} 类型Q信息待清理。", QMessageType,QMessageCount);
            } else {
                return string.Format(@"{0} 信箱编号为 {1} PNR为 {2} {3} 订票员标识:{4}", QMessageType, QMessageNo,PNRNo,!HasChanged?@"无变更":@"存在变更",EmployeeNo);
            }
        }
    }

    /// <summary>
    /// 清Q插件配置类.
    /// </summary>
    public sealed class QConfig : BasePlugInConfig {
        /// <summary>
        /// 清理信箱条名称(默认为：SR、SC)
        /// </summary>
        public List<string> QMessageTmp { get; set; }

        /// <summary>
        /// 航班变更标识(默认为：HX|UN|NO|UC)
        /// </summary>
        public List<string> QChangedTmp { get; set; }

        /// <summary>
        /// 预定人员标识获取规则(默认：(\s{0,}\d+\.)REM\s+\d{4}\s+\d{4}\s+([A-Z0-9\-]+))
        /// </summary>
        public List<string> QRule { get; set; }
    }
}
